import request from '@/utils/request'
import { getToken } from '@/utils/auth'

export function queryAllWarehouse(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/warehouse/queryAllWarehouse',
    method: 'get',
    params: query
  })
}

export function getUserByName(name) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/store/getUserByName?userName=' + name + '',
    method: 'get'
  })
}

export function saveWarehouse(formData) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/warehouse/saveWarehouse',
    method: 'post',
    data: formData
  })
}

export function updateWarehouse(formData) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/warehouse/updateWarehouse',
    method: 'post',
    data: formData
  })
}

export function deleteStoreByWarehouseId(formData) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/warehouse/deleteStoreByWarehouseId',
    method: 'delete',
    data: formData
  })
}

export function queryList(query) {
  return request({

    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/warehouse/queryList',
    method: 'get',
    params: query
  })
}

export function getUserByWarehouseName(name) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/store/getUserByWarehouseName?userName=' + name + '',
    method: 'get'
  })
}
